<?php
$dbhost = 'localhost';  // mysql服务器主机地址
$dbuser = 'ether_gq';            // mysql用户名
$dbpass = '8MN6ZYmayNbRwxm7';          // mysql用户名密码
$dbname = 'ether_gq';
$conn = mysqli_connect($dbhost, $dbuser, $dbpass,$dbname);

$username = $_POST["username"];
$username = "'".$username."'";

$text = str_replace("\r\n","<br />",$_POST["text"]);
$text = str_replace("\n","<br />",$text);
$text = htmlspecialchars($text);

$text = ","."'".$text."'";
$leave_word = "insert into leave_word (username,text) values (".$username.$text.")";

if (mysqli_query($conn,$leave_word))
{
	echo '留言成功！';
}
else
{
	echo "Error: " . $sign . "<br>" . mysqli_error($conn);
};

mysqli_close($conn);

?>